<!-- 公共头部 -->
<?php 

//		首页设置
		$setindex = Db::table('setting')->get();
//		分类数据
		$catemodel = new \Home\Model\Cate;
//		全部
		$catedata = $catemodel->get();
//		顶级分类
		$catedatatop = $catemodel->where("pid=0")->get();
//		和首页设置关联
		$catedata_setindex = $catemodel->join('setting','cid','=','stcid')->get();
 ?>
 		
		<link href="./Public/other/css/publichead.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" href="./Public/css/index.css" />
		<div class="header clearfix">
			<div class="logo">
				<h1>
					<a title="ZOL商城" href="{{U('Index/index')}}" class="mall-logo">
					</a>
				</h1>
				<p>
					中关村在线旗下网上商城
				</p>
			</div>
			<div class="search-box">
				<form action=" " method="get">
					<input type="hidden" name="c" value="List">
					<div class="search">
						<input name="keyword" type="text" class="search-text" autocomplete="off" value=""/>
						<input type="submit" value="搜 索" class="search-btn" hidefocus="true"/>
					</div>
				</form>
				<div class="hot-search" id="noresearch_keyword">
					<a href=" " target="_blank" title="iPhone 6s">
						iPhone 6s
					</a>
					<a href=" " target="_blank" title="魅蓝metal">
						魅蓝metal
					</a>
					<a href=" " target="_blank" title="乐视1S">
						乐视1S
					</a>
					<a href=" " target="_blank" title="iPhone6">
						iPhone6
					</a>
					<a href=" " target="_blank" title="三星A8000">
						三星A8000
					</a>
				</div>
			</div>
			<div class="ad-div">
				<a href=" " target="_blank">
					<img width="180" height="60" src="./Public/other/image/ChMkJlYcpziIdMcxAAB2sdYBFdcAADnzQKpVyIAAHbJ372.jpg" alt="ZOL商城承诺">
				</a>
			</div>
		</div>
		<div class="nav-box" style="z-index:20;">
			<div class="category-nav-container" onmouseover="showNavUl();" onmouseout="hideNavUl();">
				<h2 class="category-nav-title">
					全部商品分类
					<i class="ico">
					</i>
				</h2>
				<div class="category-menu-nav" id="category-menu-nav" style="display:none;">
				<div style="width: 200px;height: 411px;" id="main">
					<ul class="list">
						{{foreach from="$catedatatop" key="$k" value="$v"}}
			<li>
				<i class="iconfont i">{{$setindex[$k]['index_sth']}}</i>
				<div class="co">
					<a href="{{U('Lists/index',array('cid'=>$v['cid']))}}">{{$v['cname']}}</a>
				</div>
				<div class="yc_list">
					<dl class="service">
						 <dt><a href="" target="_blank">服务保障</a></dt>
						 <dd class="clearfix">
							 <a href=" " target="_blank"><i class="iconfont">&#xe609;</i>行货保证</a>
							 <a href="#"><i class="iconfont">&#xe60b;</i>发票保障</a>
							 <a href="" target="_blank"><i class="iconfont">&#xe60f;</i>24小时发货</a>
							 <a href=" " target="_blank"><i class="iconfont">&#xe60e;</i>顺丰包邮</a>
							 <a href=" " target="_blank"><i class="iconfont">&#xe60d;</i>无忧退换</a>
							 <a href=" " target="_blank"><i class="iconfont">&#xe60a;</i>先行赔付</a>
						 </dd>
                    </dl>
                    
                    {{foreach from="$catedata_setindex" key="$kk" value="$vv"}}
                    	{{if value="$vv['pid']==$v['cid']"}}
                    <dl>
						<dt><a href="{{U('Lists/index',array('cid'=>$vv['cid']))}}">{{$vv['cname']}}</a></dt>
						<dd>
							<p>
								<?php 
								$index_list = explode('|', $vv['index_list']);
								//循环数组依次添加
								foreach ($index_list as $list) {
									$list = trim($list);
									//如果不为空的时候
									if($list != ''){
										//实体化，防止js运行
										$list = htmlspecialchars($list);
										//组合要添加的数组
										echo '<a href="">'.$list.'</a>|';
									}
								}
								 ?>
							</p>
							<p>
								<?php 
								$index_a = explode('|', $vv['index_a']);
								//循环数组依次添加
								foreach ($index_a as $lista) {
									$lista = trim($lista);
									//如果不为空的时候
									if($lista != ''){
										//实体化，防止js运行
										$lista = htmlspecialchars($lista);
										//组合要添加的数组
										echo '<a href="">'.$lista.'</a>|';
									}
								}
								 ?>
							</p>
						</dd>
					</dl>
					{{endif}}
					{{endforeach}}
				
				</div>
			</li>
			{{endforeach}}

					</ul>
					<a href="" class="ip">
						<img src="./Public/images/ip6.jpg" alt="" />
					</a>
				</div>
			</div>
			</div>
			<ul class="nav clearfix">
				<li >
					<a href="#"  target="_blank">
						首页
					</a>
				</li>
				<li >
					<a href="#"  target="_blank">
						Z团
					</a>
				</li>
				<li >
					<a href="#"  target="_blank">
						手机馆
					</a>
				</li>
				<li >
					<a href="#"  target="_blank">
						DIY攒机馆
					</a>
				</li>
				<li >
					<a href="#"  target="_blank">
						限时抢购
					</a>
				</li>
				<li >
					<a href="#"  target="_blank">
						众筹
					</a>
				</li>
			</ul>
			<div class="nav-tips">
				<a href="#"  target="_blank">
					2016无线购物节 全场19元起
				</a>
			</div>
		</div>
		<script type="text/javascript">function showNavUl() {
	document.getElementById("category-menu-nav").style.display = "block";
}

function hideNavUl() {
	document.getElementById("category-menu-nav").style.display = "none";
}

function showNavList(obj) {
	obj.className = "current";
}

function hideNavList(obj) {
	obj.className = " ";
}
var searchFunction = {
	searchKeyword: null,
	searchButton: null,
	searchHistory: null,
	searchHistoryList: null,
	searchHistoryListDel: null,
	searchHistoryListClose: null,
	getHistoryList: function() {
		if (typeof jQuery == "undefined") {
			return false;
		} else {
			var url = "#" + Math.random();
			$.getJSON(url, function(data) {
				if (data.msg) {
					$(".search").append(data.msg);
					searchFunction.getElements();
					searchFunction.eventListener();
				}
			});
		}
	},
	getElements: function() {
		searchFunction.searchKeyword = document.querySelector(".search .search-text");
		searchFunction.searchButton = document.querySelector(".search .search-btn");
		searchFunction.searchHistory = document.querySelector(".search-history");
		searchFunction.searchHistoryList = document.querySelectorAll(".search-history ul li");
		searchFunction.searchHistoryListDel = document.querySelectorAll(".search-history ul li .delete");
		searchFunction.searchHistoryListClose = document.querySelector(".search-history .close");
	},
	eventListener: function() {
		searchFunction.searchKeyword.addEventListener("focus", function() {
			searchFunction.showHistory();
		});
		searchFunction.searchKeyword.addEventListener("click", function() {
			searchFunction.showHistory();
		});
		searchFunction.searchKeyword.addEventListener("keypress", function(e) {
			if (window.event) {
				e = window.event;
			}
			var keyNumber = e.keyCode;
			if (13 == keyNumber) {
				searchFunction.searchButton.click();
			}
		});
		searchFunction.searchHistory.addEventListener("mouseleave", function() {
			searchFunction.hideHistory();
		});
		searchFunction.searchHistoryListClose.addEventListener("click", function() {
			searchFunction.hideHistory();
		});
		for (var i = 0; i < searchFunction.searchHistoryList.length; i++) {
			searchFunction.searchHistoryList[i].addEventListener("click", searchFunction.clickHistory(searchFunction.searchHistoryList[i]));
		}
		for (var i = 0; i < searchFunction.searchHistoryListDel.length; i++) {
			searchFunction.searchHistoryListDel[i].addEventListener("click", searchFunction.deleteHistory(searchFunction.searchHistoryListDel[i]));
		}
	},
	showHistory: function() {
		searchFunction.searchHistory.style.display = "block";
	},
	clickHistory: function(obj) {
		return function() {
			searchFunction.searchKeyword.value = obj.getAttribute("keyword");
			searchFunction.searchButton.click();
		};
	},
	deleteHistory: function(obj, e) {
		return function() {
			searchFunction.stopPropagation(e);
			var dataId = obj.getAttribute("data-id");
			var url = "#" + Math.random();
			$.getJSON(url, {
				dataId: dataId
			}, function(data) {
				if (data.flag) {
					obj.parentNode.style.display = "none";
				}
			});
		};
	},
	hideHistory: function() {
		searchFunction.searchHistory.style.display = "none";
	},
	stopPropagation: function(e) {
		e = e || window.event;
		if (e.stopPropagation) {
			e.stopPropagation();
		} else {
			e.cancelBubble = true;
		}
	}
};
searchFunction.getHistoryList();
if (document.getElementById('noresearch_keyword')) {
	document.getElementById('noresearch_keyword').addEventListener('click', function() {
		getUserTrack('noresearch_keyword');
	});
}</script>
		<!-- //公共头部 -->